@*Hdip Project 2013-14, Student Name:- Chris Pembroke,  Student Number:- x00115839*@
@model Exercise1Project.Models.BikeService

@{
    ViewBag.Title = "CreateService";
    ViewBag.Temp = TempData["QuoteOrService"];
    TempData.Keep("QuoteOrService");
    string bid = TempData["bike_id"].ToString();
    int bikeId = Int32.Parse(bid);
    TempData.Keep("bike_id");

    string statusbikeInShop;
    string StatusService;
    ViewBag.QuoteOrService = TempData["QuoteOrService"];
    TempData.Keep("QuoteOrService");
    if (ViewBag.Temp == "Quote")                                   // if create quote is selected
    {
        statusbikeInShop = "Not In Shop";
        StatusService = "Quote";
    }
    else                                                     // if create service is selected
    {
        statusbikeInShop = "Not In Shop";
        StatusService = "Booked";
    }
}

<div class="viewContainerDiv2">

    <h2>Create</h2>

    <p>
        @Html.DropDownList("Items")&nbsp&nbsp
        @Html.DropDownList("Actions")
        &nbsp&nbsp&nbsp<button onclick="AddListItem()">ADD</button>
    </p>
    <div>

        <div class="col-md-10">
            @Html.DropDownList("ServiceItems")
            &nbsp&nbsp&nbsp<button onclick="return RemoveListItem();">REMOVE</button> @ViewBag.CreateError
        </div>
    </div>

    @using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()

        <div class="form-horizontal">


            @Html.ValidationSummary(true)

            <div class="form-group">
                @* @Html.LabelFor(model => model.SelectedItems, new { @class = "control-label col-md-2" })*@
                <div class="col-md-10">
                    @Html.HiddenFor(model => model.SelectedItems)
                    @Html.ValidationMessageFor(model => model.SelectedItems)
                </div>
            </div>

            <div class="form-group">
                @* @Html.LabelFor(model => model.StatusBikeInShop, new { @class = "control-label col-md-2" })*@
                <div class="col-md-10">
                    @Html.HiddenFor(b => statusbikeInShop, new { @readonly = "readonly" })
                    @Html.ValidationMessageFor(model => model.StatusBikeInShop)
                </div>
            </div>

            <div class="form-group">
                @* @Html.LabelFor(model => model.StatusService, new { @class = "control-label col-md-2" })*@
                <div class="col-md-10">
                    @Html.HiddenFor(b => StatusService, new { @readonly = "readonly" })
                    @Html.ValidationMessageFor(model => model.StatusService)
                </div>
            </div>

            @if (ViewBag.Temp == "Service")
            {
                <div class="form-group" id="hidetest1">
                    @Html.LabelFor(model => model.Date, new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.TextBox("Date", "", new { @class = "date-picker" })
                        @Html.ValidationMessageFor(model => model.Date)
                    </div>
                </div>
            }

            @*
                <div class="form-group">
                    @Html.LabelFor(model => model.Date, new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.Date)
                        @Html.ValidationMessageFor(model => model.Date)
                    </div>
                </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.QuotedPrice, new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.HiddenFor(model => model.QuotedPrice)
                            @Html.ValidationMessageFor(model => model.QuotedPrice)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.PartsCost, new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.HiddenFor(model => model.PartsCost)
                            @Html.ValidationMessageFor(model => model.PartsCost)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.LabourCost, new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.HiddenFor(model => model.LabourCost)
                            @Html.ValidationMessageFor(model => model.LabourCost)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.TotalPrice, new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.HiddenFor(model => model.TotalPrice)
                            @Html.ValidationMessageFor(model => model.TotalPrice)
                        </div>
                    </div>
            *@
            <div class="form-group">
                @* @Html.LabelFor(model => model.BikeID, new { @class = "control-label col-md-2" })*@
                <div class="col-md-10">
                    @Html.HiddenFor(b => bikeId)
                    @Html.ValidationMessageFor(model => model.BikeID)
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-offset-2 col-md-10">
                    <input type="submit" value="Create" class="btn btn-default" />
                </div>
            </div>
        </div>
    }

    <div>
        @Html.ActionLink("Back to Service List", "ServiceList", new { id = bikeId })
    </div>

</div>

    @section Scripts {
        @Scripts.Render("~/bundles/jqueryval")
        <link href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.min.css" rel="stylesheet" type="text/css" />
        <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
        <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
        <script type="text/javascript" src="@Url.Content("/Scripts/bikeservices.js")"></script>
        <link rel="stylesheet" href="@Url.Content("~/Content/customised.css")" />
    }
